Document the fact that there might not be a volume for all paths.
authorAlexander Larsson <alexl@redhat.com>
Fri, 5 Mar 2004 07:46:06 +0000 (07:46 +0000)
committerAlexander Larsson <alexl@src.gnome.org>
Fri, 5 Mar 2004 07:46:06 +0000 (07:46 +0000)
2004-03-05  Alexander Larsson  <alexl@redhat.com>

* gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path):
Document the fact that there might not be a volume for all
paths.

* gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
Don't assume there is a volume for all paths.

ChangeLog
ChangeLog.pre-2-10
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
gtk/gtkfilechooserdefault.c
gtk/gtkfilesystem.c

index c34388f68ef568e79b9754292456c960e00cb410..51db8459f69ea7bd1a50f8b6c7099b9a49841280 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2004-03-05  Alexander Larsson  <alexl@redhat.com>
+
+       * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path):
+       Document the fact that there might not be a volume for all
+       paths.
+
+       * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
+       Don't assume there is a volume for all paths.
+
 Fri Mar  5 01:45:04 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (shortcuts_append_paths): insert in
index c34388f68ef568e79b9754292456c960e00cb410..51db8459f69ea7bd1a50f8b6c7099b9a49841280 100644 (file)
@@ -1,3 +1,12 @@
+2004-03-05  Alexander Larsson  <alexl@redhat.com>
+
+       * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path):
+       Document the fact that there might not be a volume for all
+       paths.
+
+       * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
+       Don't assume there is a volume for all paths.
+
 Fri Mar  5 01:45:04 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (shortcuts_append_paths): insert in
index c34388f68ef568e79b9754292456c960e00cb410..51db8459f69ea7bd1a50f8b6c7099b9a49841280 100644 (file)
@@ -1,3 +1,12 @@
+2004-03-05  Alexander Larsson  <alexl@redhat.com>
+
+       * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path):
+       Document the fact that there might not be a volume for all
+       paths.
+
+       * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
+       Don't assume there is a volume for all paths.
+
 Fri Mar  5 01:45:04 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (shortcuts_append_paths): insert in
index c34388f68ef568e79b9754292456c960e00cb410..51db8459f69ea7bd1a50f8b6c7099b9a49841280 100644 (file)
@@ -1,3 +1,12 @@
+2004-03-05  Alexander Larsson  <alexl@redhat.com>
+
+       * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path):
+       Document the fact that there might not be a volume for all
+       paths.
+
+       * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
+       Don't assume there is a volume for all paths.
+
 Fri Mar  5 01:45:04 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (shortcuts_append_paths): insert in
index c34388f68ef568e79b9754292456c960e00cb410..51db8459f69ea7bd1a50f8b6c7099b9a49841280 100644 (file)
@@ -1,3 +1,12 @@
+2004-03-05  Alexander Larsson  <alexl@redhat.com>
+
+       * gtk/gtkfilesystem.c (gtk_file_system_get_volume_for_path):
+       Document the fact that there might not be a volume for all
+       paths.
+
+       * gtk/gtkfilechooserdefault.c (shortcuts_add_current_folder):
+       Don't assume there is a volume for all paths.
+
 Fri Mar  5 01:45:04 2004  Jonathan Blandford  <jrb@gnome.org>
 
        * gtk/gtkfilechooserdefault.c (shortcuts_append_paths): insert in
index 1692c2d093ba4e05637c2e7f711c0a273d12f0e6..8369716d3437602b2400a40824457379a090f59a 100644 (file)
@@ -1088,20 +1088,25 @@ shortcuts_add_current_folder (GtkFileChooserDefault *impl)
       pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER);
 
       volume = gtk_file_system_get_volume_for_path (impl->file_system, impl->current_folder);
-      base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
-
-      if (strcmp (gtk_file_path_get_string (base_path), gtk_file_path_get_string (impl->current_folder)) == 0)
+      if (volume)
+       base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
+      else
+       base_path = NULL;
+      
+      if (base_path &&
+         strcmp (gtk_file_path_get_string (base_path), gtk_file_path_get_string (impl->current_folder)) == 0)
        {
          success = shortcuts_insert_path (impl, pos, TRUE, volume, NULL, NULL, FALSE, NULL);
          impl->shortcuts_current_folder_is_volume = TRUE;
        }
       else
        {
-         gtk_file_system_volume_free (impl->file_system, volume);
          success = shortcuts_insert_path (impl, pos, FALSE, NULL, impl->current_folder, NULL, FALSE, NULL);
          impl->shortcuts_current_folder_is_volume = FALSE;
        }
 
+      if (volume)
+       gtk_file_system_volume_free (impl->file_system, volume);
       gtk_file_path_free (base_path);
 
       if (!success)
index 156d352f133bdc86f81a82cdb4a92bf2aa26e723..2c018a9d433b0f6be293c77a208308d45d304353 100644 (file)
@@ -340,9 +340,12 @@ gtk_file_system_create_folder(GtkFileSystem     *file_system,
  * @path: a #GtkFilePath
  * 
  * Queries the file system volume that corresponds to a specific path.
+ * There might not be a volume for all paths (consinder for instance remote
+ * shared), so this can return NULL.
  * 
  * Return value: the #GtkFileSystemVolume that corresponds to the specified
- * @path.  You should free this value with gtk_file_system_volume_free().
+ * @path, or NULL if there is no such volume. You should free this value with
+ * gtk_file_system_volume_free().
  **/
 GtkFileSystemVolume *
 gtk_file_system_get_volume_for_path (GtkFileSystem     *file_system,